#ifndef TIMER_H_
#define TIMER_H_

#ifdef TIMER8
	#define _TCCR0	TCCR0
	#define _TIMSK	TIMSK

#else
	#define _TCCR0	TCCR0B
	#define _TIMSK	TIMSK0

#endif


#include "Structs.h"
#include "avr/interrupt.h"

#define TimerCount	10

class clVirtualTimer: public clMain{
	public:
		static uint16_t Timing[TimerCount];
		static void (*Jobs[TimerCount])();
		static bool AddTimerUS8X(uint8_t delayUS8X, void (*Job)(void));
		static void NullJobs(void){};
	protected:
		static void TimerOn(void);
};

class clTimer0: public clVirtualTimer{
	public:
		static void TimerOverflow(void);
		static void PauseUSx8(uint8_t delayUS8X);
	private:
		static bool _PauseExpired;
		static void _Pause(void);
		static void TimerOn(void);
		static void TimerOff(void);
		static void SetNewTiming(void);
};

ISR(TIMER0_OVF_vect){
	clTimer0::TimerOverflow();
}

#include "Timer.cpp"

#endif